import {FORMATION, NOTICE} from '@/services/api'
import {request, METHOD} from '@/utils/request'

/**
 *
 * @param pageQuery 查询条件
 * @returns Promise<AxiosResponse>
 */
export async function page(pageQuery) {
    return request(NOTICE.NOTICE_PAGE, METHOD.POST, {
        ...pageQuery
    })
}

/**
 *
 * @param notice
 * @returns Promise<AxiosResponse>
 */
export async function save(notice) {
    return request(NOTICE.NOTICE_ADD_OR_UPDATE, METHOD.POST, {
        ...notice,
    })
}

export async function read(id) {
    return request(NOTICE.NOTICE_READ + `/${id}`, METHOD.POST, {})
}

export const columns = [
    {
        title: '接收人',
        dataIndex: 'user.name',
        align: 'center',
    },
    {
        title: '内容',
        dataIndex: 'title',
        align: 'center',
    },
    {
        title: '描述',
        dataIndex: 'description',
        align: 'center',
    },
    {
        title: '状态',
        dataIndex: 'status',
        align: 'center',
    },
    {
        title: '操作',
        align: 'center',
        scopedSlots: {customRender: 'action'}
    }
]
